package com.atguigu.gulimall.search.controller;

import com.atguigu.gulimall.search.service.MallSearchService;
import com.atguigu.gulimall.search.vo.searchParam;
import com.atguigu.gulimall.search.vo.SearchResult;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;

/**
 * @author ct_start
 * @create 2022 -03 -06
 **/
@Controller
public class SearchController {

    @Resource
    MallSearchService mallSearchService;

    @GetMapping("list.html")
    public String returnSearch(searchParam param, Model model){
        SearchResult result =mallSearchService.search(param);
        model.addAttribute("result",result);
        return "list";
    }
}
